//
//  JFBAdviceDS.m
//  ios-supplier 用户建议
//
//  Created by feynmanyuan on 15/4/22.
//  Copyright (c) 2015年 feynmanyuan. All rights reserved.
//

#import "JFBAdviceDS.h"

@implementation JFBAdviceDS
+ (NSURLSessionDataTask *)advice:(void (^)(BOOL isSuccess, NSString *message, NSError *error))block advice:(NSString*)advice {
    
    NSDictionary *staffParams = @{@"error_content": advice};
    
    return [[JFBAPIClient sharedClient:true] GET:@"/app_error/add.json" parameters:staffParams success:^(NSURLSessionDataTask * __unused task, id JSON) {
        NSObject * error = [JSON valueForKey:@"error"];
        if( error == [NSNull null] ) {
            block(true, @"感谢您的建议", nil);
        } else {
            block(true, @"提交失败，请稍后重试", nil);
        }
    } failure:^(NSURLSessionDataTask *__unused task, NSError *error) {
        block(false, @"提交失败，请稍后重试", error);
    }];
    return nil;
}
@end
